package com.wude.guild.adapter;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.wude.bean.GiftInfo;
import com.wude.guild.holder.DanGiftHolder;

import java.util.ArrayList;
import java.util.List;

/**
 * 游戏详情礼包Adapter
 * Created by Administrator on 2017/3/13.
 */

public class GameDetListGiftAdapter extends BaseAdapter {
    private final Activity con;
    public List<GiftInfo> list = new ArrayList<GiftInfo>();

    public GameDetListGiftAdapter(Activity activity) {
        this.con = activity;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        DanGiftHolder holder = null;
        if (convertView == null) {
            holder = new DanGiftHolder();
        } else {
            holder = (DanGiftHolder) convertView.getTag();
        }
        GiftInfo giftInfo = list.get(position);
        holder.setData(giftInfo, position, con);
        return holder.getContentView();
    }


    public void setList(List<GiftInfo> b) {
        this.list = b;
        notifyDataSetChanged();
    }

    public List<GiftInfo> getList() {
        return list;
    }
}
